﻿using System.Collections.Generic;
using ZooKeeperNet;

namespace ZooKeeperManage
{
    /// <summary>
    /// 任务控制
    /// </summary>
    public class DispatchManage
    {
        private readonly ZooKeeperService _zkService;

        public DispatchManage(string connectstring = "127.0.0.1:2181")
        {
            // 主
            // 从
            _zkService = new ZooKeeperService(connectstring);
            //zkService
            //创建服务
        }

        public void Create(string path)
        {
            bool temp = _zkService.Create(path, "str".GetBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.Ephemeral)== CreateResultEnum.Success;
        }

        public List<string> GetChildren(string path)
        {
            return _zkService.GetChildren(path);
        }

    }



    /// <summary>
    /// 领导者
    /// </summary>
    public class Leader
    {

    }
    /// <summary>
    /// 跟随者
    /// </summary>
    public class Follower
    {

    }
    /// <summary>
    /// 观察者
    /// </summary>
    public class Observer
    {
    }
    /// <summary>
    /// 客户端
    /// </summary>
    public class Client
    {

    }

}
